Messenger of Allah, do you think if there is any reward (of the Lord with me on the Day of Resurrection) for the deeds of religious purification that I performed in the state of ignorance, such as charity, freeing a slave, cementing of blood-relations? Upon this he (the Messenger of Allah) said to him: You have accepted Islam with all the previous virtues that you had practised. (Using translation from Muslim 123b)
أَخْبَرَهُ أَنَّهُ قَالَ يَا رَسُولَ اللهِ أَرَأَيْتَ أُمُورًا كُنْتُ أَتَحَنَّثُ بِهَا فِي الْجَاهِلِيَّةِ مِنْ صَدَقَةٍ أَوْ عَتَاقَةٍ أَوْ صِلَةِ رَحِمٍ أَفِيهَا أَجْرٌ؟ فَقَالَ رَسُولُ اللهِ ﷺ «أَسْلَمْتَ عَلَى مَا أَسْلَفْتَ مِنْ خَيْرٍ»